<!DOCTYPE html>
<html class="x-admin-sm">
    
    <head>
        <meta charset="UTF-8">
        <title>新增广告位</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
    </head>
    <body>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                <form class="layui-form" action="">
                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span>*</span>
                             展示渠道
                        </label>
                        <div class="layui-input-block lafite_width_30">
                            <select name="city" lay-verify="required">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            <span>*</span>
                            广告位置
                        </label>
                        <div class="layui-input-block lafite_width_30">
                            <select name="city" lay-verify="required">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">
                             <span>*</span>
                             主题
                            </label>
                            <div class="layui-input-inline">
                            <input type="text" name="title" required  lay-verify="required" placeholder="请输入主题" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">
                             <span>*</span>
                             Url
                            </label>
                            <div class="layui-input-inline">
                            <input type="text" name="title" required  lay-verify="required" placeholder="http://" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">
                            封面图
                        </label>
                        <div class="layui-upload">
                            <button type="button" class="layui-btn lafite_btn" id="lafite_upload">点击上传</button> 
                            <blockquote class="layui-elem-quote layui-quote-nm" style="width: 60%;margin-top: 10px; margin-left: 5%">
                                预览图：
                                <div class="layui-upload-list" id="demo2"></div>
                            </blockquote>
                        </div>
                    </div>
                   
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="lafite-layui-btn" onclick="xadmin.del_tab()">取消</button>
                            <button lay-submit lay-filter="formDemo" class="lafite-layui-btn2 lafite_margin_left_20px">保存</button>
                        </div>
                    </div>
                    </form>
                </div>
            </div>
        </div>
    </body>
    <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&amp;ak=f5bKSDjUlnYT4r664aQrQZB8&s=1"></script>
    <script>layui.use(['laydate', 'form', 'upload'],
        function() {
            var $ = layui.jquery
            ,upload = layui.upload;

            var laydate = layui.laydate;

            //多图片上传
            upload.render({
                elem: '#lafite_upload'
                ,url: '/upload/'
                ,multiple: true
                ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
                });
                }
                ,done: function(res){
                //上传完毕
                }
            });

            /*用户-取消*/
            function member_del() {
                layer.confirm('离开将不保存填写内容！',
                function(index) {
                    //发异步删除数据
                });
            }

            // 百度地图API功能
            var map = new BMap.Map("lafite_map");
            var point = new BMap.Point(116.331398,39.897445);
            map.centerAndZoom(point,12);

            function myFun(result){
                var cityName = result.name;
                map.setCenter(cityName);
            }
            var myCity = new BMap.LocalCity();
            myCity.get(myFun);
            function showInfo(e){
                $(".lafite_default_map").val(e.point.lng+','+e.point.lat);
            }
            map.addEventListener("click", showInfo);
            });
            
            var top_left_control = new BMap.ScaleControl({anchor: BMAP_ANCHOR_TOP_LEFT});// 左上角，添加比例尺
            var top_left_navigation = new BMap.NavigationControl();  //左上角，添加默认缩放平移控件
            var top_right_navigation = new BMap.NavigationControl({anchor: BMAP_ANCHOR_TOP_RIGHT, type: BMAP_NAVIGATION_CONTROL_SMALL}); //右上角，仅包含平移和缩放按钮
            map.enableScrollWheelZoom(true);     //开启鼠标滚轮缩放

    </script>

</html>